package edu.trinity.cs.eclass

import swing._

/**
 * Main for the electronic classroom app. This lets people log in.
 */
object Main {
  private val semesterList = new ListView[SemesterData]
  private val courseList = new ListView[CourseData]
  private val displayPanel = new GridPanel(1,1)
  
  def main(args: Array[String]) {
    // TODO contact server and get information
    val frame = new MainFrame {
      title = "Electronic Classroom"
      menuBar = new MenuBar {
        contents += new Menu("File") {
          contents += new MenuItem("Login") {
            action = Action("Login") {
              if (text == "Login") {
                text = "Logout"
              } else {
                text = "Login"
              }
            }
          }
          contents += new Separator
          contents += new MenuItem(Action("Exit")(sys.exit(0)))
        }
      }
      contents = new SplitPane(Orientation.Vertical,
          new GridPanel(1,2) {
            contents += new ScrollPane(semesterList)
            contents += new ScrollPane(courseList)
          },displayPanel)
      size = new Dimension(800, 600)
    }
    frame.open()
  }
}